package com.vtron.mq.service;

import com.vtron.mq.models.MsgPackage;
import com.vtron.mq.models.PackageType;
import org.springframework.kafka.support.SendResult;
import org.springframework.util.concurrent.FailureCallback;
import org.springframework.util.concurrent.ListenableFutureCallback;
import org.springframework.util.concurrent.SuccessCallback;

import java.util.function.Consumer;

/**
 * 消息包服务接口
 * @date : 2022/4/26 16:27
 * @author: 忻龙彪
 */
public interface IMsgPackageService {

    /**
     * 发送消息包
     */
    void send(MsgPackage msg);
    void send(MsgPackage msg,ListenableFutureCallback<SendResult<String, String>> callback);
    void send(String topic,MsgPackage msg);
    void send(String topic,MsgPackage msg,ListenableFutureCallback<SendResult<String, String>> callback);
    /**
     * 发送消息包
     * @param type 数据类型
     * @param body 数据包
     */
    void send(PackageType type, String body);
    void send(PackageType type, String body,ListenableFutureCallback<SendResult<String, String>> callback);
    void send(String topic,PackageType type, String body);
    void send(String topic,PackageType type, String body,ListenableFutureCallback<SendResult<String, String>> callback);
}
